<!DOCTYPE html>
<html lang="zh-CN" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layout/default">
<head>
    <meta charset="UTF-8">
    <title>机构管理</title>
    <script type="text/javascript" th:src="@{/assets/plugins/jquery-treetable/jquery.treetable.js}"></script>
    <script>
        $(document).ready(function () {
            $("#treeTable").treetable();
        });
    </script>
</head>
<body>
<div layout:fragment="content" th:remove="tag">
    <div th:replace="fragments/tool :: tipMessage (type='',content=${message})" th:remove="tag"></div>
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <h3 class="page-title">
                机构管理
                <small>维护系统中所用到的机构部门</small>
            </h3>
            <ul class="page-breadcrumb breadcrumb">
                <li class="btn-group">
               		<form th:action="@{/sys/office/form}" method="post">
						<button type="submit" class="btn blue dropdown-toggle"
							data-delay="1000" data-close-others="true">
							<span> + 机构添加</span>
						</button>
					</form>
                </li>
                <li>
                    <i class="fa fa-home"></i>
                    <a th:href="@{/}">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">权限管理</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li><a th:href="@{/sys/office}">机构管理</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->

        </div>
    </div>


    <div class="row profile">
        <div class="col-md-12">
            <!--BEGIN TABS-->
            <div class="tabbable tabbable-custom tabbable-full-width">
                <div class="tab-content">

                    <div class="tab-pane active" id="office_tab_1_1">
                        <div class="row">
                            <div class="col-md-12">
                                <form id="menuListForm" method="post">
                                    <table id="treeTable" class="table table-striped table-bordered table-advance table-hover">
                                        <thead>
                                        <tr>
                                            <th>名称</th>
                                            <th>机构类型</th>
                                            <th width="150px">创建时间</th>
                                            <th>创建者</th>
                                            <th width="300px">描述</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each="item : ${list}"
                                            th:attr="data-tt-id=${item.id}"
                                            th:attrappend="data-tt-parent-id=${item.parent.id}">
                                            <td><a th:href="@{/sys/office/form(id=${item.id})}" th:text="${item.name}">name</a></td>
                                            <td th:text="${@userMenus.getDictLabel(item.type, 'sys_office_type', '无')}">type</td>
                                            <td th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}">createDate</td>
                                            <td th:text="${item.createBy.loginName}">loginName</td>
                                            <td th:text="${item.remarks}">remarks</td>
                                            <td>
                                                <a th:href="@{/sys/office/form(id=${item.id})}"
                                                   class="btn default btn-xs blue-stripe">修改</a>
                                                <a th:href="@{/sys/office/delete(id=${item.id})}"
                                                   onclick="return App.confirm('要删除该机构及所有子机构项吗？', this.href)"
                                                   class="btn default btn-xs red-stripe">删除</a>
                                                <a th:href="@{/sys/office/form(parent.id=${item.id})}"
                                                   class="btn default btn-xs green-stripe">添加下级机构</a>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>


</div>


</body>
</html>
